// pages/shiye/shiye.ts
Page({
  /**
   * 页面的初始数据
   */
  data: {
    visible: false,
    nickname: "",
    questionList: [
      // "请生成一份法律尽职调查报告的示例",
      "再查查产品介绍",
      "再查查的产品特性与优势",
      "尽职调查工作流程主要包括哪几个方面",
    ] as string[],
    question: "",
  },
  sendFn() {
    wx.navigateTo({
      url: `/subPackages/packageB/report/report?question=${
        this.data.question || ""
      }`,
      success: () => {
        this.setData({
          question: "",
        });
      },
    });
  },
  onChanged(e: any) {
    this.setData({
      question: e.detail,
    });
  },
  gotoList(e: any) {
    wx.nextTick(() => {
      wx.navigateTo({
        url: `/subPackages/packageB/report/report?question=${e.currentTarget.dataset.question}`,
      });
    });
  },
  // getTabBar 回调设置自定义tab-bar 高亮
  getInstance() {
    if (typeof this.getTabBar === "function") {
      const tabBar = this.getTabBar();
      tabBar.setData({
        active: 2,
      });
    }
  },
  //设置菜单
  setMenu() {
    this.setData({ visible: true });
  },
  //通知介绍
  gotoNotice() {
    wx.navigateTo({ url: "/subPackages/packageB/notice/notice" });
  },
  //跳转尽调报告
  reportFn() {
    this.setData({ pageSign: "report" });
  },
  //跳转到智能问答
  questionFn() {
    this.setData({ pageSign: "question" });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    const userInfo = wx.getStorageSync("userInfo");
    this.setData({
      nickname: userInfo.nickname,
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getInstance();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {},

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage() { },
});
